<template>
  <div class="container contract-review mb70">
    <p class="bread">
      <a href="#/index/tm-order-list" class="font-s-18">交易监控订单管理-监控师</a> >
      <a href="javascript:void(0);" class="font-s-16">详情</a>
    </p>
    <div class="bg-c-fff box-border">
      <h3 class="tm-title">交易监控订单详情</h3>
      <step :stepData="stepData" :stepNum="stepNum" @stepRouter="stepRouter"></step>
    </div>
    <div class="content bg-c-fff tc">
      <div class="box auto">
        <div class="file-box auto box-border">
          <ul>
            <li v-for="item in fileList" class="ico">
              <span class="iconfont icon-file-copy icon"></span>
              <a :href="item.address" download>{{item.address | fileName}}</a>
            </li>
          </ul>
        </div>
      </div>
      <p class="tc state">状态：
        <span v-if="report === 0">待上传</span>
        <span v-else>已上传</span>
      </p>
      <button type="button" class="blue-button xl-btn-css" @click="onNextStop" v-if="jurisdicType">下一步</button>
    </div>
  </div>
</template>
<script type="text/javascript">
import Step from '../components/Step'
export default {
  components: {
    Step
  },
  data() {
    return {
      stepNum: 0,
      report: 0,
      stepData: [{
        name: '查看资质审查报告'
      }, {
        name: '审查合同'
      }, {
        name: '绘制流程图'
      }, {
        name: '绘制完成'
      }],
      fileList: [],
      status: '',
      jurisdicType: true
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    onNextStop() {
      this.$router.push('/tm-transaction-contract?id=' + this.$route.query.id)
    },
    getData() {
      this.$http.post('/transactionMonitorSer/sys/read/detail', {
        id: this.$route.query.id
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.fileList = data.data.data.fileList
          this.status = data.data.data.status
          this.report = data.data.data.reportNum
          if (this.status > 2) {
            this.jurisdicType = false
          }
        } else {
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
        this.$toasted.show('网络出错')
      })
    },
    stepRouter(i, name) {
      if (i === 0 && this.status >= 2) {
        this.$router.push('/tm-transaction-aptitude?id=' + this.$route.query.id)
      }
      if (i === 1 && this.status >= 3) {
        this.$router.push('/tm-transaction-contract?id=' + this.$route.query.id)
      }
      if (i === 2 && this.status > 4) {
        // this.$router.push('/tm-transaction-draw?id=' + this.$route.query.id)
        this.$toasted.show('请查看绘制完成图')
      }
      if (i === 2 && this.status === 4) {
        this.$router.push('/tm-transaction-draw?id=' + this.$route.query.id)
      }
      if (i === 3 && this.status >= 5) {
        this.$router.push('/tm-transaction-draw-finish?id=' + this.$route.query.id)
      }
    }
  },
  filters: {
    fileName(v) {
      return v.split('/')[v.split('/').length - 1]
    }
  }
}

</script>
<style type="text/css" scoped>
.content {
  padding: 30px 0;
  margin-top: 20px;
}

.content .box {
  width: 600px;
  min-height: 150px;
  border: 1px solid #ddd;
}

.content button {
  margin-top: 40px;
}

.ico {
  margin-top: 40px;
  line-height: 50px;
  margin-bottom: 50px;
  margin-left: 200px;
  text-align: left;
}

.icon {
  font-size: 50px;
  color: #d8e7ff;
  vertical-align: middle;
}

</style>
